/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.tnmk.worktime.gui.widget;

/**
 *
 * @author tnmkhoi
 */
public class MessagePanel extends javax.swing.JPanel implements PopupPanel{
  /**Auto injected when popup is initiated*/
  PanelPopup popup;
  
  public MessagePanel() {
    initComponents();
//    setVisible(true);
  }

  public void setMessage(String str) {
    this.jlblMessage.setText(str);
  }



  /**
   * This method is called from within the constructor to initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is always
   * regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jlblMessage = new javax.swing.JLabel();
    jLabel1 = new javax.swing.JLabel();

    setBackground(new java.awt.Color(51, 51, 51));
    setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 2, 2, new java.awt.Color(179, 179, 179)), javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))));
    addMouseListener(new java.awt.event.MouseAdapter() {
      public void mouseClicked(java.awt.event.MouseEvent evt) {
        formMouseClicked(evt);
      }
    });

    jlblMessage.setBackground(new java.awt.Color(204, 204, 204));
    jlblMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jlblMessage.setText("Message...");
    jlblMessage.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 0, 1, 0, new java.awt.Color(0, 0, 0)));
    jlblMessage.setOpaque(true);

    jLabel1.setFont(new java.awt.Font("Tahoma", 3, 11)); // NOI18N
    jLabel1.setForeground(new java.awt.Color(204, 204, 204));
    jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Product_Gray_80.png"))); // NOI18N
    jLabel1.setText(" Daily Record");

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(jlblMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 235, Short.MAX_VALUE)
      .addGroup(layout.createSequentialGroup()
        .addContainerGap()
        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        .addComponent(jLabel1)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
        .addComponent(jlblMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addContainerGap())
    );
  }// </editor-fold>//GEN-END:initComponents

  private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked
    if (evt.getClickCount() >= 2) {
      this.popup.hide();
    }
  }//GEN-LAST:event_formMouseClicked


  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JLabel jLabel1;
  private javax.swing.JLabel jlblMessage;
  // End of variables declaration//GEN-END:variables

  @Override
  public void setPopup(PanelPopup popup) {
    this.popup = popup;
  }
}
